package io.jpress.addon.partnershipauthorities.controller;

import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Page;
import io.jboot.web.controller.annotation.RequestMapping;
import io.jboot.web.validate.EmptyValidate;
import io.jboot.web.validate.Form;
import io.jpress.addon.partnershipauthorities.model.JpressAddonPartnershipauthorities;
import io.jpress.addon.partnershipauthorities.service.JpressAddonPartnershipauthoritiesService;
import io.jpress.core.menu.annotation.AdminMenu;
import io.jpress.web.base.AdminControllerBase;
import io.jpress.web.base.TemplateControllerBase;


@RequestMapping(value = "/partnershipauthorities")
public class JpressAddonPartnershipauthoritiesController extends TemplateControllerBase {

    @Inject
    JpressAddonPartnershipauthoritiesService service;

    public void index() {

        setMenuActive(menu -> {
            if (menu.isUrlEquals("/partnershipauthorities/index")) {
                return true;
            }
            return false;
        });

        render("partnershipauthorities.html");
    }

    /**
     * 查询详情
     */
    public void content() {
        Long id = getParaToLong("id", 0L);
        JpressAddonPartnershipauthorities jpressAddonPartnershipauthorities = service.findById(id);
        setAttr("jpressAddonPartnershipauthorities",jpressAddonPartnershipauthorities);
        render("partnershipauthorities_content.html");
    }

    /**
     * 查询详情
     */
    public void contentjson() {
        Long id = getParaToLong("id", 0L);
        JpressAddonPartnershipauthorities jpressAddonPartnershipauthorities = service.findById(id);
        setAttr("jpressAddonPartnershipauthorities",jpressAddonPartnershipauthorities);
        renderJson(Ret.ok().set("partnershipauthorities",jpressAddonPartnershipauthorities));
    }
}
